import { executeSql } from '../util/db.js';


export const selectUserByUsernameAndPassword = function (username, password) {
    let sql = "select id,username,nickname,email,userPic from users where username=? and password=?";
    return executeSql(sql, [username, password])
}

export const selectUserInfo = function () {
    let sql = "select nickname,userPic from users";
    return executeSql(sql)
}

export const selectUserDetail = function () {
    let sql = "select username,nickname,email,userPic,password from users";
    return executeSql(sql)
}
//编辑用户信息
export const updateUserInfo = function (username, nickname, email, userPic, password) {
    let sql = "update users set username=?,nickname=?,email=?,userPic=? where username=? and password=?";
    return executeSql(sql, [username, nickname, email, userPic, username, password])
}